<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>骑手信息修改</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form">
    <div class="layui-form-item">
        <label class="layui-form-label required">骑手编号id</label>
        <div class="layui-input-block">
            <input type="text" name="horsemanId"  id="horsemanId" value="" class="layui-input" readonly>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">骑手用户名</label>
        <div class="layui-input-block">
            <input type="text" id="horsemanNumber" name="horsemanNumber"  value="" class="layui-input" readonly>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label required">骑手姓名</label>
        <div class="layui-input-block">
            <input type="text" id="horsemanName" name="horsemanName"  value="" class="layui-input" readonly>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="text" name="horsemanPassword" id="horsemanPassword" required="required" value="" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机号码</label>
        <div class="layui-input-block">
            <input type="text" name="horsemanPhone" id="horsemanPhone" readonly  value="" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">骑手类型</label>
        <div class="layui-input-block">
            <select name="horsemanType" id="horsemanType" lay-filter="horsemanType" lay-verify="required">
                <option value="">--请选择--</option>
                <option value="1">加盟骑手</option>
                <option value="2">合作骑手</option>
                <option value="3">自营骑手</option>
            </select>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">骑手星级</label>
        <div class="layui-input-block">
            <select name="horsemanStarLevel" id="horsemanStarLevel" lay-filter="horsemanStarLevel" lay-verify="required">
                <option value="">--请选择--</option>
                <option value="0.00">八星</option>
                <option value="0.03">七星</option>
                <option value="0.06">六星</option>
                <option value="0.08">五星</option>
                <option value="0.1">四星</option>
                <option value="0.13">三星</option>
                <option value="0.15">二星</option>
                <option value="0.18">一星</option>
            </select>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">区域</label>
        <div class="layui-input-block">
            <input type="text" name="horsemanArea" id="horsemanArea" readonly  value="" class="layui-input">
        </div>
    </div>



    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认修改</button>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" id="fanhui">返回</button>
        </div>
    </div>
</div>
</div>
<script src="../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="../../lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>

<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            //系统公告
            console.log(JSON.stringify(data.field))
            $.ajax({
                type: "post",
                url: "../horseman/updateHorseman",
                dataType: "json",
                contentType:'application/json;charset=utf-8',
                data:JSON.stringify(data.field),
                success: function (result) {
                    if(result.result=="success"){
                        layer.msg('修改成功');
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                        //parent.$("#shousuobtn",parent.document).trigger('click');	//子页面局部刷新父页面事件
                        window.parent.document.getElementById("shousuobtn").click();
                    }
                    console.info(result);
                },
                error: function () {
                    console.log("网络出错！请重新连接")
                }
            });

            return false;
        });
    });
    $(document).ready(function(){
        //id查询赋值
        $.ajax({
            type: "get",
            url: "/horseman/idquerysession",
            dataType: "json",
            success: function (result) {
               console.log(result);
               //$("#orderNumber").attr("value",result.order.orderNumber)
                console.log(result);
                $("#horsemanId").attr("value",result.horseman.horsemanId);
                $("#horsemanName").val(result.horseman.horsemanName);
                $("#horsemanNumber").attr("value",result.horseman.horsemanNumber);
                $("#horsemanPassword").attr("value",result.horseman.horsemanPassword);
                $("#horsemanPhone").attr("value",result.horseman.horsemanPhone);
                $("#horsemanArea").attr("value",result.horseman.horsemanArea);
                if(result.horseman.horsemanType==1){
                    $("#horsemanType").attr("value","加盟骑手");
                }else if(result.horseman.horsemanType==1){
                    $("#horsemanType").attr("value","合作骑手");
                }
                /* $("#horsemanStarLevel").attr("value",result.horseman.horsemanStarLevel);
                 var img=result.order.orderImg;
                  var index=img.lastIndexOf("\,");
                  img=img.substring(index+1,img.length);
                 $('#orderImg').attr("src",img);*/
            },
            error: function () {
                console.log("网络出错！请重新连接")
            }
        });
    });
</script>
</body>
</html>